﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MovieUI.aspx.cs" Inherits="ISSMoviePlex.Admin.Movie" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView ID="MovieGridView" runat="server" AutoGenerateColumns="False" 
        DataSourceID="MovieDataSource" AllowPaging="True" PageSize="5" 
        CellPadding="4" DataKeyNames="MovieId" ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="MovieId" HeaderText="Movie ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="MovieId" Visible="False" />
            <asp:BoundField DataField="MovieName" HeaderText="Movie Name" 
                SortExpression="MovieName" />
            <asp:TemplateField HeaderText="Poster" SortExpression="Poster">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Poster") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="PosterImage" runat="server" ImageUrl='<%# Bind("Poster") %>' Height="50" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Plot" HeaderText="Plot" SortExpression="Plot" 
                Visible="False" />
            <asp:BoundField DataField="Duration" HeaderText="Duration" 
                SortExpression="Duration" DataFormatString="{0} min" />
            <asp:BoundField DataField="Language" HeaderText="Language" 
                SortExpression="Language" />
            <asp:BoundField DataField="Cast" HeaderText="Cast" SortExpression="Cast" />
            <asp:BoundField DataField="AverageRating" HeaderText="Average Rating" 
                SortExpression="AverageRating" />
            <asp:BoundField DataField="StartDate" HeaderText="Start Date" 
                SortExpression="StartDate" DataFormatString="{0:d}" />
            <asp:BoundField DataField="EndDate" HeaderText="End Date" 
                SortExpression="EndDate" DataFormatString="{0:d}" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
    <asp:ObjectDataSource ID="MovieDataSource" runat="server" 
        DataObjectTypeName="ISSMoviePlex.DAL.Models.Movie" DeleteMethod="DeleteMovie" 
        InsertMethod="AddMovie" SelectMethod="GetAllMovies" 
        TypeName="ISSMoviePlex.BLL.MovieBLL" UpdateMethod="UpdateMovie">
    </asp:ObjectDataSource>
    <br />
    <br />
    <br />
    Movie Details<br />
    <br />
    <asp:DetailsView ID="MovieDetailsView" runat="server" AutoGenerateRows="False" 
        CellPadding="4" DataKeyNames="MovieId" DataSourceID="DetailViewMovieDataSource" 
        ForeColor="#333333" GridLines="None" Height="50px" Width="900px">
        <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <EditRowStyle BackColor="#2461BF" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
        <Fields>
            <asp:BoundField DataField="MovieId" HeaderText="Movie ID" InsertVisible="False" 
                SortExpression="MovieId" Visible="False" />
            <asp:TemplateField HeaderText="Movie Name" SortExpression="MovieName">
                <EditItemTemplate>
                    <asp:TextBox ID="tbMovieName" runat="server" Text='<%# Bind("MovieName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="tbMovieName" ErrorMessage="Please enter Movie Name" 
                        CssClass="failureNotification" Display="Dynamic"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbMovieName" runat="server" Text='<%# Bind("MovieName") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="tbMovieName" ErrorMessage="Please enter Movie Name" 
                        CssClass="failureNotification" Display="Dynamic"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("MovieName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Poster" SortExpression="Poster">
                <EditItemTemplate>
                    <asp:TextBox ID="tbPoster" runat="server" Text='<%# Bind("Poster") %>' 
                        TextMode="Url"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                        ControlToValidate="tbPoster" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Poster URL"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbPoster" runat="server" Text='<%# Bind("Poster") %>' 
                        TextMode="Url"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                        ControlToValidate="tbPoster" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Poster URL"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="PosterImage" runat="server" ImageUrl='<%# Bind("Poster") %>' Height="100" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Plot" SortExpression="Plot">
                <EditItemTemplate>
                    <asp:TextBox ID="tbPlot" runat="server" Text='<%# Bind("Plot") %>' 
                        TextMode="MultiLine"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="tbPlot" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Plot"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbPlot" runat="server" Text='<%# Bind("Plot") %>' 
                        TextMode="MultiLine"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ControlToValidate="tbPlot" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Plot"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("Plot") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Duration" SortExpression="Duration">
                <EditItemTemplate>
                    <asp:TextBox ID="tbDuration" runat="server" Text='<%# Bind("Duration") %>' 
                        TextMode="Number"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                        ControlToValidate="tbDuration" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Duration"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator2" runat="server" 
                        ControlToValidate="tbDuration" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter a number between 30 and 300" MaximumValue="300" 
                        MinimumValue="30" Type="Integer"></asp:RangeValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbDuration" runat="server" 
                        Text='<%# Bind("Duration", "{0} minutes") %>' TextMode="Number"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ControlToValidate="tbDuration" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Duration"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" 
                        ControlToValidate="tbDuration" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter a number between 30 and 300" MaximumValue="300" 
                        MinimumValue="30" Type="Integer"></asp:RangeValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" 
                        Text='<%# Bind("Duration", "{0} minutes") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Language" SortExpression="Language">
                <EditItemTemplate>
                    <asp:TextBox ID="tbLanguage" runat="server" Text='<%# Bind("Language") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                        ControlToValidate="tbLanguage" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Language"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbLanguage" runat="server" Text='<%# Bind("Language") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                        ControlToValidate="tbLanguage" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Language"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("Language") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Cast" SortExpression="Cast">
                <EditItemTemplate>
                    <asp:TextBox ID="tbCast" runat="server" Text='<%# Bind("Cast") %>' 
                        MaxLength="100"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" 
                        ControlToValidate="tbCast" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Cast"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbCast" runat="server" Text='<%# Bind("Cast") %>' 
                        MaxLength="100"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" 
                        ControlToValidate="tbCast" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Cast"></asp:RequiredFieldValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("Cast") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Average Rating" SortExpression="AverageRating">
                <EditItemTemplate>
                    <asp:TextBox ID="tbRating" runat="server" Text='<%# Bind("AverageRating") %>' 
                        TextMode="Number"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" 
                        ControlToValidate="tbRating" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Rating"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator4" runat="server" 
                        ControlToValidate="tbRating" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter a number between 0 and 5" MaximumValue="5" 
                        MinimumValue="0" Type="Integer"></asp:RangeValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbRating" runat="server" Text='<%# Bind("AverageRating") %>' 
                        TextMode="Number"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" 
                        ControlToValidate="tbRating" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter Rating"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator3" runat="server" 
                        ControlToValidate="tbRating" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter a number between 0 and 5" MaximumValue="5" 
                        MinimumValue="0" Type="Integer"></asp:RangeValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("AverageRating") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Start Date - End Date" 
                SortExpression="StartDate">
                <EditItemTemplate>
                    <asp:TextBox ID="tbStartDate" runat="server" Text='<%# Bind("StartDate", "{0:yyyy-MM-dd}") %>' 
                        TextMode="Date"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server" 
                        ControlToValidate="tbStartDate" CssClass="failureNotification" 
                        Display="Dynamic" ErrorMessage="Please enter Start Date"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator6" runat="server" 
                        ControlToValidate="tbStartDate" CssClass="failureNotification" 
                        Display="Dynamic" ErrorMessage="Please enter a date in the future" 
                        MaximumValue="3000-12-31" 
                        MinimumValue='<%# DateTime.Now.ToString("yyyy-MM-dd") %>' 
                        Type="Date"></asp:RangeValidator>
                    <br />
                    <asp:TextBox ID="tbEndDate" runat="server" Text='<%# Bind("EndDate", "{0:yyyy-MM-dd}") %>' 
                        TextMode="Date"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server" 
                        ControlToValidate="tbEndDate" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter End Date"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator2" runat="server" 
                        ControlToCompare="tbStartDate" ControlToValidate="tbEndDate" 
                        CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="End Date must be greater than Start Date" Operator="GreaterThan" 
                        Type="Date"></asp:CompareValidator>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="tbStartDate" runat="server" 
                        Text='<%# Bind("StartDate", "{0:d}") %>' TextMode="Date"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" 
                        ControlToValidate="tbStartDate" CssClass="failureNotification" 
                        Display="Dynamic" ErrorMessage="Please enter Start Date"></asp:RequiredFieldValidator>
                    <asp:RangeValidator ID="RangeValidator5" runat="server" 
                        ControlToValidate="tbStartDate" CssClass="failureNotification" 
                        Display="Dynamic" ErrorMessage="Please enter a date in the future" 
                        MaximumValue="3000-12-31" MinimumValue='<%# DateTime.Now.ToString("yyyy-MM-dd") %>' Type="Date"></asp:RangeValidator>
                    <br />
                    <asp:TextBox ID="tbEndDate" runat="server" 
                        Text='<%# Bind("EndDate", "{0:d}") %>' TextMode="Date"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" 
                        ControlToValidate="tbEndDate" CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="Please enter End Date"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" 
                        ControlToCompare="tbStartDate" ControlToValidate="tbEndDate" 
                        CssClass="failureNotification" Display="Dynamic" 
                        ErrorMessage="End Date must be greater than Start Date" Operator="GreaterThan" 
                        Type="Date"></asp:CompareValidator>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("StartDate", "{0:d}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowInsertButton="True" />
        </Fields>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
    </asp:DetailsView>
    <asp:ObjectDataSource ID="DetailViewMovieDataSource" runat="server" 
        DataObjectTypeName="ISSMoviePlex.DAL.Models.Movie" DeleteMethod="DeleteMovie" 
        InsertMethod="AddMovie" SelectMethod="GetMovie" 
        TypeName="ISSMoviePlex.BLL.MovieBLL" UpdateMethod="UpdateMovie">
        <SelectParameters>
            <asp:ControlParameter ControlID="MovieGridView" DefaultValue="1" Name="MovieId" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <br />
    <br />
    <br />
</asp:Content>

